﻿using BootstrapBlazor.Components;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using TrackSystem.Entities.Dtos.Equip;
using TrackSystem.Entities.Extensions;


namespace TrackSystem.Entities.Dtos.Loop
{
    /// <summary>
    /// 控制回路表
    /// </summary>
    public class LoopDto
    {
        /// <summary>
        /// 统一标识符
        /// </summary>
        [Display(Name = "ID")]
        [AutoGenerateColumn(Order = 1)]
        public int Id { get; set; }

        /// <summary>
        /// 控制回路名称
        /// </summary>
        [Required]
        [Display(Name = "名称")]
        [AutoGenerateColumn(Order = 10, Filterable = true, Searchable = true)]
        public required string Name { get; set; }

        /// <summary>
        /// 控制回路描述
        /// </summary>
        [Display(Name = "描述")]
        [AutoGenerateColumn(Order = 20, Filterable = true, Searchable = true)]
        public string? Description { get; set; }

        /// <summary>
        /// 实际值变量名称
        /// </summary>
        [Display(Name = "过程值")]
        [AutoGenerateColumn(Order = 30)]
        public string PVName { get; set; }

        /// <summary>
        /// 设定值变量名称
        /// </summary>
        [Display(Name = "设定值")]
        [AutoGenerateColumn(Order = 40)]
        public string SVName { get; set; }

        /// <summary>
        /// 输出值变量名称
        /// </summary>
        [Display(Name = "输出值")]
        [AutoGenerateColumn(Order = 50)]
        public string OPName { get; set; }

        /// <summary>
        /// 调节方法
        /// </summary>
        [Display(Name = "控制策略")]
        [AutoGenerateColumn(Order = 60)]
        public LoopMethod Method { get; set; }

        /// <summary>
        /// 手动自动方式
        /// </summary>
        [Display(Name = "手自动")]
        [AutoGenerateColumn(Order = 70)]
        public bool Action { get; set; }

        /// <summary>
        /// 作用方式 正作用/反作用
        /// </summary>
        [Display(Name = "作用方式")]
        [AutoGenerateColumn(Order = 80)]
        public bool Dirction { get; set; }

        /// <summary>
        /// 比例参数
        /// </summary>
        [Display(Name = "比例")]
        [AutoGenerateColumn(Order = 90)]
        public double Params_P { get; set; }

        /// <summary>
        /// 积分参数
        /// </summary>
        [Display(Name = "积分")]
        [AutoGenerateColumn(Order = 100)]
        public double Params_I { get; set; }

        /// <summary>
        /// 微分参数
        /// </summary>
        [Display(Name = "微分")]
        [AutoGenerateColumn(Order = 110)]
        public double Params_D { get; set; }

        /// <summary>
        /// 输出上限
        /// </summary>
        [Display(Name = "输出上限")]
        [AutoGenerateColumn(Order = 120)]
        public double OutHLimit { get; set; }

        /// <summary>
        /// 输出下限
        /// </summary>
        [Display(Name = "输出下限")]
        [AutoGenerateColumn(Order = 130)]
        public double OutLLimit { get; set; }

        /// <summary>
        /// 设定值字符串
        /// </summary>
        [Display(Name = "设定参数")]
        [AutoGenerateColumn(Order = 140)]
        public string? Setting { get; set; }

        /// <summary>
        /// 死区设置 0-100%
        /// </summary>
        [Display(Name = "死区上限")]
        [AutoGenerateColumn(Order = 150)]
        public int PDeadZone { get; set; }

        /// <summary>
        /// 死区设置 0-100%
        /// </summary>
        [Display(Name = "死区下限")]
        [AutoGenerateColumn(Order = 160)]
        public int NDeadZone { get; set; }

        /// <summary>
        /// PID运算范围系数
        /// </summary>
        [Display(Name = "倍率")]
        [AutoGenerateColumn(Order = 170)]
        public double Ratio { get; set; }

        /// <summary>
        /// 该传感器关联的设备ID
        /// </summary>
        [Display(Name = "设备ID")]
        [AutoGenerateColumn(Order = 180)]
        public int equipId { get; set; }

        /// <summary>
        /// 该传感器关联的设备描述
        /// </summary>
        [Display(Name = "设备信息")]
        [AutoGenerateColumn(Order = 190)]
        public EquipDto? Equip { get; set; }

    }
}
